package com.dc.ws.client;

import java.io.BufferedReader;
import java.io.CharArrayWriter;
import java.io.FileReader;

import javax.xml.namespace.QName;

import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.rpc.client.RPCServiceClient;

public class Client {
	public static void main(String[] args) throws Exception{
		try{
			RPCServiceClient serviceClient = new RPCServiceClient();
			Options options = serviceClient.getOptions();
			EndpointReference targetEPR = new EndpointReference("http://localhost:6100/sip/services/Engine");
			options.setTo(targetEPR);	
			/*BufferedReader bufferedReader = new BufferedReader(new FileReader("c:/data.xml"));
			CharArrayWriter charArrayWriter = new CharArrayWriter();
			String input = null;
			while((input= bufferedReader.readLine())!=null){
				charArrayWriter.write(input);
			}
			bufferedReader.close();

			charArrayWriter.close();*/
			Object[] clientArgs = new Object[]{"CSAT",""};
			Class[] classes = new Class[]{String.class,String.class};
			QName nsName = new QName("http://server.engine.eies.com","startEngine");
			System.out.println(serviceClient.invokeBlocking(nsName, clientArgs,classes)[0]);
		}catch (Exception e) {
			e.printStackTrace();
		}
	}
}
